package com.example.router_processor

import com.example.router_annotation.Route
import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.processing.SymbolProcessor
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
import com.google.devtools.ksp.symbol.KSAnnotated
import com.google.devtools.ksp.validate

class RouterProcessor(environment: SymbolProcessorEnvironment): SymbolProcessor {
    private val logger = environment.logger
    override fun process(resolver: Resolver): List<KSAnnotated> {
        val symbols = resolver.getSymbolsWithAnnotation(Route::class.qualifiedName!!)
        val annotationClasses = symbols.filter { it.validate() }.toList()
        logger.warn("Route annotation classes: annotationClasses=${annotationClasses}")
        return annotationClasses
    }
}